local ma__zhiyong = fk.CreateSkill {
  name = "ma__zhiyong",
}

Fk:loadTranslationTable{
  ["ma__zhiyong"] = "猘勇",
  [":ma__zhiyong"] = "当你受到伤害后，你可以摸X张牌（X为你已损失的体力值），然后若此技能发动次数不为X，此技能发动时机改为“造成伤害或进入濒死状态后”。",

  ["$ma__zhiyong1"] = "",
  ["$ma__zhiyong2"] = "",
}

local spec = {
  on_cost = function (self, event, target, player, data)
      return player.room:askToSkillInvoke(player, {
    skill_name = ma__zhiyong.name,
  })
  end,
  on_use = function(self, event, target, player, data)
    local num = player:getLostHp()
    player:drawCards(num, ma__zhiyong.name)
    if player:usedSkillTimes(ma__zhiyong.name, Player.HistoryGame) ~= num and player:getMark("ma__zhiyong_wake") == 0 then
      player.room:addPlayerMark(player, "ma__zhiyong_wake", 1)
    end
  end,
}

ma__zhiyong:addEffect(fk.Damaged, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(ma__zhiyong.name) and player:getMark("ma__zhiyong_wake") == 0
  end,
  on_cost = spec.on_cost,
  on_use = spec.on_use,
})

ma__zhiyong:addEffect(fk.Damage, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(ma__zhiyong.name) and player:getMark("ma__zhiyong_wake") > 0
  end,
  on_cost = spec.on_cost,
  on_use = spec.on_use,
})
ma__zhiyong:addEffect(fk.EnterDying, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(ma__zhiyong.name) and player:getMark("ma__zhiyong_wake") > 0
  end,
  on_cost = spec.on_cost,
  on_use = spec.on_use,
})

return ma__zhiyong